import {request} from "network/request";

/**
 * 查询商品的所有信息
 * @param id 商品id
 * @returns {*}
 */
export function getDetail(id){
  return request({
    method: 'get',
    url: '/detail',
    params: {
      iid: id
    }
  });
}

/**
 * 查询详情页信息
 * @returns {*}
 */
export function getShopperXinXi() {
  return request({
    method: 'get',
    url: '/recommend'
  });
}

export class getDetailInfo {
  constructor(itemInfo,columns,services) {
    this.title = itemInfo.title;
    this.oldPrice = itemInfo.oldPrice;
    this.price = itemInfo.price;
    this.desc = itemInfo.desc;
    this.disCountDesc = itemInfo.discountDesc;
    this.columns = columns;
    this.services = services;
  }
}

export class getShopperInfo {
  constructor(shopInfo) {
    this.shopLogo = shopInfo.shopLogo;
    this.name = shopInfo.name;
    this.sells = shopInfo.cSells;
    this.score = shopInfo.score;
    this.cFans = shopInfo.cFans;
    this.cGoods = shopInfo.cGoods;
  }
}

export class getDetailListImg {
  constructor(detailInfo) {
    this.desc = detailInfo.desc;
    this.key = detailInfo.detailImage[0].key;
    this.list = detailInfo.detailImage[0].list;
  }
}

export class getComment {
  constructor(userInfo) {
    this.rate = userInfo;
  }
}

export class getDetailParamInfo {
  constructor(paramInfo) {
    this.image = paramInfo.info.images ? paramInfo.info.images[0] : null;
    this.set = paramInfo.info.set;
    this.rule = paramInfo.rule.tables;
  }
};

/**
 * 推荐数据
 */
export class getDetailShopper {
  constructor(resDetail) {
    this.DetailList = resDetail;
  }
};

/**
 * 购物车商品信息
 */
export class shoppingTrolley {
  constructor(item,id) {
    this.topImages = item.topImages[0];
    this.desc = item.desc;
    this.price = item.lowPrice;
    this.title = item.title;
    this.id = id;
    this.cartCount = 1;
    this.checked = true;
  }
}

/**
 * 整合Beauty
 */
export class beautyClass {
  constructor(data) {
    this.beauty_img = data.beauty_img;
    this.beauty_back = data.beauty_back;
    this.beauty_url = data.beauty_url;
  }
}